'use strict';

const Controller = require('egg').Controller;

const jwt = require('jsonwebtoken');

class PowerController extends Controller {
  async menu() {
    // token
    const {ctx} = this;
    // console.log("=====",ctx.request.header.token);
    let token = ctx.request.header.token;
    let info = jwt.verify(token,'1705b');
    //查权限
    try{
        let data = await this.service.power.menu(info.roleid);
        console.log("data====",data)
        ctx.body = {
            code:1,
            data
        }
    }catch(e){
        ctx.body = {
            code:0,
            msg:e
        }
    }
  }
}

module.exports = PowerController;
